<!--{template common/header}-->

<!--{if !empty($message)}-->
<script type="text/javascript" onload="1">
<!--{eval $_G['setting']['bbname'] = str_replace('\\\'', '\\\\\'', $_G['setting']['bbname']);}-->
if(document.body.stat) document.body.stat('register_succeed', 'member.php?mod={$_G[setting][regname]}');
display('main_regmessaqge');
display('layer_reg');
display('layer_regmessage');
<!--{if $_G['setting']['regverify'] == 1}-->
	$('messageleft1').innerHTML = '<p>{lang register_succeed} <!--{echo addslashes($_G['setting']['bbname'])}--></p><p>{lang profile_email_verify}</p>';
	$('messageright1').innerHTML = '<a href="home.php?mod=spacecp&ac=profile&op=password">{lang user_center}</a><br />{lang profile_email_verify_comment}';
	setTimeout("window.location.href='home.php?mod=spacecp&ac=profile&op=password'", $mrefreshtime);
<!--{elseif $_G['setting']['regverify'] == 2}-->
	$('messageleft1').innerHTML = '<p>{lang register_succeed} <!--{echo addslashes($_G['setting']['bbname'])}--></p><p>{lang register_manual_verify}</p>';
	$('messageright1').innerHTML = '<a href="home.php?mod=spacecp&ac=profile&op=password">{lang user_center}</a>';
	setTimeout("window.location.href='home.php?mod=spacecp&ac=profile&op=password'", $mrefreshtime);
<!--{else}-->
	$('messageleft1').innerHTML = '<p>{lang register_succeed} <!--{echo addslashes($_G['setting']['bbname'])}--></p>';
	<!--{eval $dreferer = str_replace('&amp;', '&', dreferer());}-->
	<!--{if $dreferer}-->
		$('messageright1').innerHTML = '<a href="javascript:;" onclick="location.href=\'$dreferer\';">{lang login_refresh}</a>';
		setTimeout('location.href=\'$dreferer\'', $mrefreshtime);
	<!--{else}-->
		$('messageright1').innerHTML = '<a href="javascript:;" onclick="location.reload()">{lang login_refresh}</a>';
	<!--{/if}-->
<!--{/if}-->
setMenuPosition('fwin_register', 'fwin_register', '00');
</script>
<!--{else}-->
<!--{if empty($_G['gp_infloat'])}-->
<div id="ct" class="wp cl">
	<div class="mn">
<!--{/if}-->
<div class="blr" id="main_regmessaqge">
	<h3 id="layer_reginfo_t" class="flb"{if $bbrules && $bbrulesforce} style="display: none"{/if}>
		<em id="returnmessage4"><!--{if !empty($_G['gp_infloat'])}--><!--{if $_G[gp_action] != 'activation'}-->$_G['setting']['reglinkname']<!--{else}-->{lang index_activation}<!--{/if}--><!--{/if}--></em>
		<span>
			<!--{if !empty($_G['gp_infloat'])}--><a href="javascript:;" class="flbc" onclick="hideWindow('register')" title="{lang close}">{lang close}</a><!--{/if}-->
		</span>
	</h3>
	<div id="layer_bbrule"{if !($bbrules && $bbrulesforce)} style="display: none"{/if}>
		<h3 class="flb"><em>$_G['setting']['bbname'] {lang rulemessage}</em>
			<span>
				<!--{if !empty($_G['gp_infloat'])}--><a href="javascript:;" class="flbc" onclick="hideWindow('register')" title="{lang close}">{lang close}</a><!--{/if}-->
			</span>
		</h3>
		<div class="c cl{if !empty($_G['gp_infloat'])} floatwrap{/if}">$bbrulestxt</div>
		<p class="fsb pns cl{if empty($_G['gp_infloat'])} hm{/if}">
			<button class="pn pnc" onclick="$('agreebbrule').checked = true;display('layer_reg');display('layer_reginfo_t');display('layer_reginfo_b');display('layer_bbrule');{if $_G['setting']['sitemessage'][register] && ($bbrules && $bbrulesforce)}showRegprompt();{/if}"><span>{lang agree}</span></button>
			<button class="pn" onclick="{if !empty($_G['gp_infloat'])}hideWindow('register'){else}location.href='{if $_G['gp_referer']}$_G[gp_referer]{else}$_G['referer']{/if}'{/if}"><span>{lang disagree}</span></button>
		</p>
	</div>
	<!--{hook/register_top}-->
	<form method="post" autocomplete="off" name="register" id="registerform" enctype="multipart/form-data" onsubmit="ajaxpost('registerform', 'returnmessage4', 'returnmessage4', 'onerror');return false;" action="member.php?mod={$_G[setting][regname]}">
		<div id="layer_reg" class="c cl"{if $bbrules && $bbrulesforce} style="display: none"{/if}>
			<input type="hidden" name="regsubmit" value="yes" />
			<input type="hidden" name="formhash" value="{FORMHASH}" />
			<input type="hidden" name="referer" value="{if $_G['gp_referer']}$_G[gp_referer]{else}$_G['referer']{/if}" />
			<!--{if !empty($_G['gp_infloat'])}--><input type="hidden" name="handlekey" value="$_G['gp_handlekey']" /><!--{/if}-->
			<input type="hidden" name="activationauth" value="{if $_G[gp_action] == 'activation'}$activationauth{/if}" />
			<div class="lgfm">
				<div id="reginfo_a">
					<span id="activation_hidden"{if $_G[gp_action] == 'activation'} style="display:none"{/if}>
					<!--{if $invite}-->
						<span>
							<label><em>{lang register_from}:</em><a href="home.php?mod=space&uid=$invite[uid]" target="_blank">$invite[username]</a></label>
						</span>
					<!--{/if}-->
					<label><em>{lang username}:</em><input type="text" id="username" name="{$_G['setting']['reginput']['username']}" autocomplete="off" size="25" maxlength="15" value="" onBlur="checkusername()" tabindex="1" class="txt" /> *</label>
					<label><em>{lang password}:</em><input type="password" name="{$_G['setting']['reginput']['password']}" size="25" id="password" onkeypress="detectCapsLock(event, this)" tabindex="1" class="txt" /> *</label>
					<label><em>{lang password_confirm}:</em><input type="password" name="{$_G['setting']['reginput']['password2']}" size="25" id="password2" onkeypress="detectCapsLock(event, this)" tabindex="1" value="" class="txt" /> *</label>
					<label><em>{lang email}:</em><input type="text" name="{$_G['setting']['reginput']['email']}" autocomplete="off" size="25" id="email" onBlur="checkemail()" tabindex="1" class="txt" /> *</label>
					</span>
					<!--{if $_G[gp_action] == 'activation'}-->
						<span id="activation_user">
							<label><em>{lang username}:</em>$username</label>
						</span>
					<!--{/if}-->
					<!--{if empty($invite) && ($_G['setting']['regstatus'] == 2 || $_G['setting']['regstatus'] == 3)}-->
						<label class="xs2"><em>{lang invite_code}:</em><input type="text" name="invitecode" autocomplete="off" size="25" id="invitecode"{if $_G['setting']['regstatus'] == 2} onBlur="checkinvite()"{/if} tabindex="1" class="txt" /><!--{if $_G['setting']['regstatus'] == 2}--> *<!--{/if}--></label>
					<!--{/if}-->
					<!--{if $secqaacheck || $seccodecheck}-->
						<div class="rgs">
						<!--{block sectpl}--><label><em><sec>: </em><sec> *</label><label><em style="height:30px">&nbsp;</em><sec></label><!--{/block}-->
						<!--{subtemplate common/seccheck}-->
						</div>
					<!--{/if}-->
					<!--{hook/register_input}-->
				</div>
				<div id="reginfo_b"{if !empty($_G['gp_infloat'])} style="display:none"{/if}>
					<!--{if $_G['setting']['regverify'] == 2}-->
						<label><em>{lang register_message}:</em><input name="regmessage" autocomplete="off" size="25" tabindex="1" class="txt" /> *</label>
						<p class="xg1">{lang register_message1}</p>
					<!--{/if}-->
					<!--{loop $_G['cache']['fields_register'] $field}-->
					<!--{if $htmls[$field['fieldid']]}-->
						<div class="reginfo"{if $field['description']} title="{echo htmlspecialchars($field[description])}"{/if}><em>$field[title]:</em><div id="td_{$field[fieldid]}" class="reg_c">$htmls[$field['fieldid']]</div><!--{if $field['required']}-->&nbsp;*<!--{/if}--></div>
					<!--{/if}-->
					<!--{/loop}-->
				</div>
			</div>
			<div class="lgf"{if $_G[gp_action] == 'activation'} style="margin-top: 10px;"{/if}>
				<h4>{lang login_now}</h4>
				<!--{if $_G[gp_action] == 'activation'}-->
					<p>{lang login_inactive}</p>
				<!--{/if}-->
				<!--{hook/register_side}-->
			</div>
		</div>
		<p id="layer_reginfo_b" class="fsb pns cl"{if $bbrules && $bbrulesforce} style="display: none"{/if}>
			<!--{if $_G['setting']['sitemessage'][register]}--><a href="javascript:;" id="custominfo_register" class="y"><img src="{IMGDIR}/info_small.gif" alt="{lang faq}" /></a><!--{/if}-->
			<span id="reginfo_a_btn">
				<!--{if $_G[gp_action] != 'activation'}--><em>&nbsp;</em><!--{/if}-->
			<!--{if ($field || $_G['setting']['regverify'] == 2) && !empty($_G['gp_infloat'])}-->
				<button type="button" class="pn pnc" tabindex="1" onclick="regstep('reginfo_a','reginfo_b'); return false;"><span>{lang register_next}</span></button>
			</span>
			<span id="reginfo_b_btn" style="display:none">
				<button class="pn pn" tabindex="1" type="button" onclick="regstep('reginfo_b','reginfo_a'); return false;"><span>{lang register_pre}</span></button>
			<!--{/if}-->
				<button class="pn pnc" id="registerformsubmit" type="submit" name="regsubmit" value="true" tabindex="1"><span><!--{if $_G[gp_action] == 'activation'}-->{lang activation}<!--{else}-->{lang submit}<!--{/if}--></span></button>
				<!--{if $bbrules}-->
					<input type="checkbox" class="pc" name="agreebbrule" value="$bbrulehash" id="agreebbrule" checked="checked" /> <label for="agreebbrule">{lang agree}<a href="javascript:;" onclick="display('layer_reg');display('layer_reginfo_t');display('layer_reginfo_b');display('layer_bbrule');">{lang rulemessage}</a></label>
				<!--{/if}-->
			</span>
		</p>
	</form>
</div>
<div id="layer_regmessage"{if empty($_G['gp_infloat'])} class="f_c blr nfl"{/if} style="display: none">
	<h3 class="flb">
		<!--{if !empty($_G['gp_infloat'])}-->
		<em>{lang login_member}</em>
		<span><a href="javascript:;" class="flbc" onclick="hideWindow('login')" title="{lang close}">{lang close}</a></span>
		<!--{/if}-->
	</h3>
	<div class="c"><div class="alert_right">
		<div id="messageleft1"></div>
		<p class="alert_btnleft" id="messageright1"></p>
	</div>
</div>

<script type="text/javascript" reload="1">
hideWindow('login');
<!--{if $_G[gp_action] != 'activation'}-->
function initinput_register() {
	<!--{if !($bbrules && $bbrulesforce)}-->
	$('registerform').username.focus();
	<!--{/if}-->
}
if(BROWSER.ie && BROWSER.ie < 7) {
	setTimeout('initinput_register()', 500);
} else {
	initinput_register();
}
<!--{/if}-->

<!--{if $_G['setting']['sitemessage'][register]}-->
function showRegprompt() {
	showPrompt('custominfo_register', 'mouseover', '<!--{echo trim($_G['setting']['sitemessage'][register][array_rand($_G['setting']['sitemessage'][register])])}-->', $_G['setting']['sitemessage'][time]);
}
<!--{if !($bbrules && $bbrulesforce)}-->
showRegprompt();
<!--{/if}-->
<!--{/if}-->

var profile_username_toolong = '{lang register_profile_username_toolong}';
var profile_username_tooshort = '{lang register_profile_profile_username_tooshort}';
var doublee = parseInt('$_G['setting']['doublee']');
var lastusername = lastpassword = lastemail = lastinvitecode = '';

function errorhandle_register(msg, values) {
	$('returnmessage4').className = msg == '<!--{echo addslashes($_G[setting][reglinkname])}-->' ? '' : 'onerror';
	$('returnmessage4').innerHTML = msg;
}

function checkusername() {
	var username = trim($('username').value);
	if(username == '' || username == lastusername) {
		return;
	} else {
		lastusername = username;
	}
	var unlen = username.replace(/[^\x00-\xff]/g, "**").length;
	if(unlen < 3 || unlen > 15) {
		errorhandle_register(unlen < 3 ? profile_username_tooshort : profile_username_toolong, {'key':1});
		return;
	}
		ajaxget('forum.php?mod=ajax&infloat=register&handlekey=register&action=checkusername&username=' + (BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username), 'returnmessage4');
}

function checkemail() {
	var email = trim($('email').value);
	if(email == '' || email == lastemail) {
		return;
	} else {
		lastemail = email;
	}
	ajaxget('forum.php?mod=ajax&infloat=register&handlekey=register&action=checkemail&email=' + email, 'returnmessage4');
}

function checkinvite() {
	var invitecode = trim($('invitecode').value);
	if(invitecode == '' || invitecode == lastinvitecode) {
		return;
	} else {
		lastinvitecode = invitecode;
	}
	ajaxget('forum.php?mod=ajax&infloat=register&handlekey=register&action=checkinvitecode&invitecode=' + invitecode, 'returnmessage4');	
}

function trim(str) {
	return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
}
<!--{if ($field && !empty($_G['gp_infloat'])) || $_G['setting']['regverify'] == 2}-->
function regstep(obja,objb){
	$(obja).style.display = $(obja+'_btn').style.display = 'none';
	$(objb).style.display = $(objb+'_btn').style.display = '';
}
<!--{/if}-->
//note 填寫生日
function showbirthday(){
	var el = $('birthday');
	var birthday = el.value;
	el.length=0;
	el.options.add(new Option('{lang register_birthday_day}', ''));
	for(var i=0;i<28;i++){
		el.options.add(new Option(i+1, i+1));
	}
	if($('birthmonth').value!="2"){
		el.options.add(new Option(29, 29));
		el.options.add(new Option(30, 30));
		switch($('birthmonth').value){
			case "1":
			case "3":
			case "5":
			case "7":
			case "8":
			case "10":
			case "12":{
				el.options.add(new Option(31, 31));
			}
		}
	} else if($('birthyear').value!="") {
		var nbirthyear=$('birthyear').value;
		if(nbirthyear%400==0 || (nbirthyear%4==0 && nbirthyear%100!=0)) el.options.add(new Option(29, 29));
	}
	el.value = birthday;
}
</script>
<!--{/if}-->

<!--{eval updatesession();}-->
<!--{if empty($_G['gp_infloat'])}-->
	</div></div>
</div>
<!--{/if}-->
<!--{template common/footer}-->